C++ is an object-oriented programming language in which programs are created using a set of language tools, abstraction and constructs that support a particular form of user-defined types, called "classes". Each such type associates a collection of declared data with a set of operations on that data. Variables, or instances, of such types in the running programs are called objects.
Classes can be related to one another by inheritance. The properties, behaviors, data, and operations of a parent, or "base", class may be inherited without modification by some child, or "derived" class, or the behaviors, properties, and operations may be selectively refined under control of the programmer. When defining a derived class, one may start by building on an existing base class which is similar to the one to be created. The derived class inherits the implementation and behavior of the base class, except as modified by amendments detailed in the derived class definition. Several classes can inherit the behaviors of a common parent, and a derived class may inherit from more than one base class. A member function is a function or operation defined as a behaviour of some user-defined type where that type participates in a hierarchy of other types.
A feature of C++ programming is that it is text-based, and its classes are stored in separate files. Class declarations are usually split up into 2 files: a header file with extension ".h" or ".hpp" that contains the class declaration with the member fields and the member function headers, and a body file with extension ".C" or ".cpp" that contains the bodies of the member functions.
In conventional C++ programming, the header files contain important preprocessor directives and forward declarations, the latter providing the declaration ordering to ensure that every name is declared before it is used. Header files are inserted into the source file through the use of the preprocessor directive #include.
However, forward declarations must be manually prepared by the programmer; writing, organizing and maintaining header files (through program revisions) takes considerable programmer time and thought. As a result, mistakes in header files are a frequent source of compile errors.
Header files are also a major source of long program build times in C++ programming. As programmers increasingly exploit C++ classes, the cost of repeatedly reprocessing header files often dominates total compilation time. One result has been the introduction of pre-compiled header files, now supported by most commercial C++ compilers, to counter this problem.
The idea of providing for selective compilation has been addressed at varying levels of granularity. For example, UK Patent No. 2 130 406 B of Reiffen, titled Computer System with Real-time Compilation, discusses a system that partially compiles while the user is editing the source program. The compiler compiles up to a "pause location" in the source defined by the editor and then waits. When the user has made changes up to a point where the editor thinks the compiler can process more, it updates the "pause location" and the compiler does a bit more work. However, this compiler still compiles the source code from start to finish in order. If the user changes the source before the "pause location", the editor tells the compiler to re-initialize and start compiling from the start of source down to the new "pause location".
In C++ compilers, techniques for implementing a form of incremental compilation have been developed, in which a tool called "make" determines which files need to be recompiled by locating those files with time stamps after the last compilation, and then directing the compiler to compile the necessary files. However, conventional C++ compilers that effect file-based batch processing must read the declarations in order, and often read through thousands of lines of unchanged code in a file, or in the header files that the file includes, before processing a changed declaration. (Any file that includes a modified header file must be recompiled, whether or not the modification affects any definition in that file.) Also, the programmer needs to tell "make" about file-level dependencies, and this dependency information must be maintained as the system being developed evolves. While there are tools to maintain the dependencies automatically, they are very slow and, consequently, are not consistently used, leading to errors in the dependency information, and ultimately, problems during recompilation.
Therefore, a system which provided for incremental compilation of changes to C++ programs, effected at top-level declaration incrementality, would greatly reduce compilation time during program development and maintenance.
Also, entirely eliminating the need for forward declarations in C++ programming would provide a major improvement in programmer productivity by eliminating the work involved in preparing the header files initially and correcting errors identified during compilation. An enhancement to the compiler is necessary to dispense with the requirement for the ordering provided in the forward declarations.